var aUi = aUi || {};
aUi.inspection = {

	_addinspection: function(data) {

		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.stateName + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.createtime + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	_detail: function(data) {

		var html = '<li class="mui-table-view-cell">' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">' + data.createtime + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p>x' + data.qty + '</p>' +
			'<p>' + data.creator + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	//检验物料的详情
	_addInspectionDetail: function(data) {
		var inspectionQty = "0";
		var color = "#FC5959";

		if (data.inspectionQty != null) {
			inspectionQty = data.inspectionQty;
		}

		var conclusion = data.conclusion;

		if (conclusion == null || conclusion == "--" || conclusion.length == 0) {
			conclusion = "未检验";
			pickDetailQty = data.qty;
		} else {
			color = "#0091FF"
		}

		var html = '<li data-batchNumber="' + data.batchNumber + '" data-inStatus="' + data.inStatus +
			'" data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar +
			'" data-commodityname="' + data.commodityname +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p  style="color:' + color + '">' + conclusion + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p >抽检数量：' + inspectionQty + '</p>' +
			'<p >总数量：' + data.qty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../images/comman/icon_company.png">' +
			'</div>' +
			'<div class="name">' + data.manufacturer + '</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},



	_addOneInspectionDetail: function(data) {

		if (data == null || data.length == 0) {
			
			var html = this._addNoDetail("没有物料信息");
			return html;
		}
		
		
		var pickDetailQty = "0";
		var color = "#0091FF";

		var unit_price = data.unitPrice;
		if (unit_price == null || unit_price.length == 0) {
			unit_price = "未知"
		}

		var html = '<li data-commodityname="' + data.commodityname + '"  data-qty="' + data.qty +
			'"  data-commoditybar="' +
			data.commoditybar + '" data-locatorcode="' +
			data.locatorcode +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;margin-top:10px">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p class="cell-time">规格：' + data.specification + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p  style="color:' + color + '">&nbsp</p>' +
			'<p > <span class="unit">单价：</span>' + unit_price + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},


	//检验物料的详情
	_addInspectionRecording: function(data) {
		var inspectionQty = "0";
		var color = "#FC5959";

		if (data.inspectionQty != null) {
			inspectionQty = data.inspectionQty;
		}

		var conclusion = data.conclusion;

		if (conclusion == null || conclusion == "--" || conclusion.length == 0) {
			conclusion = "未检验";
			pickDetailQty = data.qty;
		} else {
			color = "#0091FF"
		}

		var html = '<li data-batchNumber="' + data.batchNumber + '" data-inStatus="' + data.inStatus +
			'" data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar +
			'" data-commodityname="' + data.commodityname +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../../images/comman/icon_materials.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p  style="color:' + color + '">' + conclusion + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p >抽检数量：' + inspectionQty + '</p>' +
			'<p >总数量：' + data.qty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../../images/comman/icon_company.png">' +
			'</div>' +
			'<div class="name">' + data.manufacturer + '</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},

	//更详细的内容
	_addInspectionMoreDetail: function(data) {

		if (data == null || data.length == 0) {
			var html = this._addNoDetail("没有更多的详细信息");
			return html;
		}

		var pickDetailQty = "0";
		var batchnoState = "";
		
		var jianBaoZhuang = data.jianBaoZhuang?data.jianBaoZhuang:""; //件包装
		// var fenzhuangbili = data.fen_zhuang_bi_li?data.fen_zhuang_bi_li:""; //分装比例
		var cunChuWendu = data.cunChuWendu?data.cunChuWendu:""; //存储温度
		// var product_type = data.product_type ? data.product_type : "";//产品分类
		var registrationNumber = data.registrationNumber ? data.registrationNumber : ""; //注册证号
		// var safeStock = data.safeStock? data.safeStock:""; //安全库存


		var color = "#0091FF";
		var html = '<li data-commodityname="' + data.commodityname + '"  data-qty="' + data.qty +
			'"  data-commoditybar="' +
			data.commoditybar + '" data-locatorcode="' +
			data.locatorcode +
			'" class="mui-table-view-cell mui-media item-cell" >' +
			'<div class="bottom-content-more">' +
			'<div class="user">' +
			'<div class="time">单位：</div>' +
			'</div>' +
			'<div class="time-sub">' + data.unit + '</div>' +
			'</div>' +
			'<div class="bottom-content-more">' +
			'<div class="user">' +
			'<div class="time">数量：</div>' +
			'</div>' +
			'<div class="time-sub">' + data.qty + '</div>' +
			'</div>' +
			// '<div class="bottom-content-more" style="display:' + "" + ';">' +
			// '<div class="user">' +
			// '<div class="time">件包装：</div>' +
			// '</div>' +
			// '<div class="time-sub">' + jianBaoZhuang + '</div>' +
			// '</div>' +
			// '<div class="bottom-content-more">' +
			// '<div class="user">' +
			// '<div class="time">安全库存：</div>' +
			// '</div>' +
			// '<div class="time-sub">' + safeStock + '</div>' +
			// '</div>' +
			// '<div class="bottom-content-more">' +
			// '<div class="user">' +
			// '<div class="time">分装比例：</div>' +
			// '</div>' +
			// '<div class="time-sub">' + fenzhuangbili + '</div>' +
			// '</div>' +
			// '<div class="bottom-content-more">' +
			// '<div class="user">' +
			// '<div class="time">存储温度：</div>' +
			// '</div>' +
			// '<div class="time-sub">' + cunChuWendu + '</div>' +
			// '</div>' +
			'<div class="bottom-content-more">' +
			'<div class="user">' +
			'<div class="time">注册证号：</div>' +
			'</div>' +
			'<div class="time-sub">' + registrationNumber + '</div>' +
			'</div>' +
			'</li>';
		return html;
	},


	//拣货详情列表
	_addNoDetail: function(title) {
		var pickDetailQty = "0";
		var color = "#0091FF";
		var html = '<li class="mui-table-view-cell mui-media item-cell" style="display:;margin-top:10px">' +
			'<div class="content-top">' +
			'<div class="top-title" >' + title + '</div>' +
			'</li>';
		return html;
	},


	inspection: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addinspection(data);
		}
		return html;
	},


	inspectionDetails: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addInspectionDetail(data);
		}
		return html;
	},
	inspectionRecording: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addInspectionRecording(data);
		}
		return html;
	},
};
